function func() {
  let a = {
    name: '刘德华',
    age: 60
  }
  const {name, age} = a
}
func()
let name = '张学友'
let flag = true
let str = `asdasdfasf${func()}`



function O() {
  this.name = '李少斌'
}
O.prototype.age = 50
function F() {}
// let obj = {
//   getName: function(name, age) {
//     this.name = name
//     this.age = age
//     console.log(this)
//   }
// }

// let o = {
  
// }
// console.log(Object.getOwnPropertyDescriptor(Object.prototype, 'toString'))
// obj.getName('刘德华', 60)

// obj.getName.call(o, '张学友', 80)
// obj.getName.apply(o, ['黎明', 50])
// obj.getName.bind(o, '郭富城', 20)()
// newFunc()

function getData() {
  let a = 1
  return function(b) {
    return a+b
  }
}
let getRes = getData()


// getData()
// console.log(o)



//1.开了新的空间或者对象
//2.执行构造函数,如果这个构造函数返回了一个复杂数据类型，new 的实例就是构造函数的返回结果
//3.改变了构造函数的this指向了第一步新开的空间，所以箭头函数不能作为构造函数
// let f1 = new F() 
// console.log(o1.__proto__ === O.prototype)
// let obj = O.prototype

// console.log(obj.__proto__ === Object.prototype)
// console.log(Object.prototype.__proto__ ===null)

// console.log(o1.getName())


// const getInfo = (...rest) => {
//   console.log(rest)
// }
// getInfo(1,2,3,4)
// function getData(arguments) {
//   console.log(rest)
// }
// function getData(a, b, ...rest) {
//   console.log(a, b, rest)
// }
// console.log(getData.name)
// getData(5,6, 10,2,2,3,4,5,7,8)
let arr = [1,2,3,4]
arr.map(item => {
  console.log(item)
  if(item === 3) {
    return false
  }
  return true
})


let arrSource = [1,2,3,3,2,1,2,3,1,1,12,3]
// let result = []//indexof
console.log( [...new Set(arrSource)])
const mySymbol = Symbol(123);
console.log(typeof mySymbol)
const a = {
  [mySymbol]:'Hello',
  a: '124'
};
console.log(a)
//取值
// console.log(a[mySymbol]) // 'Hello'
// console.log(Object.getOwnPropertySymbols(a))

// let obj = {age: 100}
// let obj1 = {name: 1, age: obj}
// console.log(Object.entries(obj1))
// let obj2 = Object.assign({}, obj1)
// let arrData = [1,2,3,4,5,{name: '张学友'}]
// let arrDataAgain = arrData

// let res = arrData.slice(0)
// arrData[5].name = 10
// console.log(arrData)
// console.log('-------')
// console.log(res)

// obj1.age.age = 200
// console.log(obj1)
// console.log('-----')
// console.log(obj2)


// let obj10 = new WeakSet()
// obj10.add({
//   des: obj11
// })
// let obj11 = {
//   des: obj10
// }


//为什么有时间循环机制？
let o = {}
let bValue = 38;
Object.defineProperty(o, "b", {
  get() {
    console.log('get')
    return bValue;
  },
  set(newValue) {
    console.log('set')
    bValue = newValue;
  },
  enumerable: true,
  configurable: true,
});
console.log(o.b)
o.b = 100